package com.cms.controller;

import java.util.Collections;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.cms.service.FundsReqService;
import com.cms.service.ReportService;
import com.google.gson.Gson;

@Controller
public class FundsReqController extends BaseController{

	 @Autowired
	 private ReportService reportService;
	 
	 
	 @Autowired
	 private FundsReqService fundsReqService;
	 
	  
	 
	 @RequestMapping(value="/funds/fundsReq.do")
	 public void queryFundsReq(HttpServletRequest req,HttpServletResponse resp)throws Exception
	 {
		 this.renderText(resp, new Gson().toJson(this.reportService.getReportResult("queryFundsReq", Collections.EMPTY_MAP)));
	 }
	 
	 
	 @RequestMapping(value="/funds/fundsCharge.do")
	 public String fundsCharge(HttpServletRequest req,HttpServletResponse resp)throws Exception
	 {
		 fundsReqService.handlerFundsChargeReq();//将状态为-1的充值记录 更改为0 正在处理
		 return "redirect:/reportMain.do?repCode=pagingUserCashRequest&pageIndex=1&pageSize=15";
	 }
	 
	 
	 @RequestMapping(value="/funds/fundsCash.do")
	 public String fundsCash(HttpServletRequest req,HttpServletResponse resp)throws Exception
	 {
		 fundsReqService.handlerFundsCashReq();
		 return "redirect:/reportMain.do?repCode=pagingUserRecharge&pageIndex=1&pageSize=15&chargeStatus=0";
	 }
}
